import { createStore, storeKey } from "vuex";
import { IRooteState } from "./types";
import login from "./login/login";

// 防止刷新后vuex中的数据消失 而缓存中仍有数据

const store = createStore<IRooteState>({
  state() {
    return {
      name: "vans",
      age: 19,
    };
  },
  mutations: {},
  actions: {},
  modules: {
    login,
  },
});

export function setupStore() {
  // 将本地缓存放入vuex中
  store.dispatch("login/loadLocalLoginData");
}

export default store;
